/****************************************************
	文件：EntityFactory.cs
	作者：HuskyT
	邮箱：1005240602@qq.com
	日期：2020/5/16 0:44:17
	功能：实体 工厂
*****************************************************/

using UnityEngine;

namespace AIBehavior
{
    public class EntityFactory : MonoBehaviour
    {
        public static IEntity Create(BehaviorType behaviorType, ref AIData data, GameObject entityPrefab, Vector3 pos, out GameObject entityGo)
        {
            GameRoot.Instance.ResetClickPos();
            entityGo = Instantiate(entityPrefab, pos, Quaternion.identity);
            data.SelfTrans = entityGo.transform;
            return BehaviorFactory.Create(data, behaviorType);
        }

        public static Obstacle CreateObstacle(GameObject obstaclePrefab, Vector3 pos)
        {
            GameObject obstacleGo = Instantiate(obstaclePrefab, pos, Quaternion.identity);
            return obstacleGo.AddComponent<Obstacle>();
        }
    }
}